package org.proddevplm.dao.data.blocks;

import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.util.ArrayList;
import java.util.List;


/**
 * Node data class;
 * Used to store one block element and nodes links.
 * If the number of nodes is greater than one then conditions must be attached
 */
@XStreamAlias("node")
public class Node extends Identifier {

    /**
     * List of conditions to be evaluated.
     * Example
     * IF block is used
     * condition1 : globalField > 1
     * condition2 : globalField <= 1
     * <p/>
     * if the change of the current node is requested or made automatically
     * than the conditions will be evaluated and the floww will follow the
     * node that satisfies the codition
     */
    @XStreamAlias("condition")
    private List<String> conditions = new ArrayList<String>();

    /**
     * List of nodes
     * if condition one is satisfied then the element located at position 0 will
     * become current flow node
     */
    @XStreamAlias("nodes")
    private List<String> nodes = new ArrayList<String>();

    /**
     * Flow block element
     */
    @XStreamAlias("block")
    private BlockElement flowElement;

    public List<String> getConditions() {
        return conditions;
    }

    public List<String> getNodes() {
        return nodes;
    }


    public BlockElement getFlowElement() {
        return flowElement;
    }

    public void setFlowElement(BlockElement flowElement) {
        this.flowElement = flowElement;
    }
}
